<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Just_show extends CI_Controller {

	function __construct(){
        parent::__construct();        
    }

	public function demand($de_id){

		//$this->init("配對", "jquery,object,object_ready,date,park,school,map,address", "form");
		$this->load->model('demand_model');		
		$this->load->model('building_name_model');
        $data["buildings"] = $this->building_name_model->get_all();
		$de_res = $this->demand_model->get_one_demand_info($de_id);
		$data["demand"] = $de_res->row();
		$data["display"] = true;
		$demand_show = $this->load->view('demand_data_edit', $data ,true);		
		return ($de_res->num_rows()>0)?$demand_show:'';

	}
	
	public function object($ob_id){

		//$this->init("配對", "jquery,object,object_ready,date,park,school,map,address", "form");
		$this->load->model('object_model');		
		$ob_res = $this->object_model->get_one_object_info($ob_id);
		$data["object"] = $ob_res->row();
		$object = $this->load->view('object_data_edit', $data , true);
		return ($ob_res->num_rows()>0)?$object:'';
	}


	public function show(){

		$this->load->model("pair_model");
		//$this->init("配對", "jquery,object,object_ready,date,park,school,map,address", "form");
		$verfiy_code = $this->input->get("verfiy_code");
		$query=$this->pair_model->get_verify_url($verfiy_code);
		$verfiy_row = $query->row();

		$url = $verfiy_row->url;
		$ex_str1=explode('?', $url);
		$ex_str2=explode('&', $ex_str1[1]);		

		$id_flag=array();		
		foreach($ex_str2 as $_num => $_str){

			$first_code=explode('=', $_str);			

			foreach($first_code as $a => $b){							
					$id_flag[]=$b;				
			} 

		}	

		

		//$data = $this->init("配對", "jquery,object,object_ready,date,park,school,map,address", "form");
		//$dem_id = $this->input->get("demand_id");
		//$obj_id = $this->input->get("object_id");
		$demand_html = $this->demand($id_flag[3]);
		$object_html = $this->object($id_flag[1]);		        

        $data = array(
            'content1' => $demand_html,
            'content2' => $object_html
        );

        $this->load->view('just_show/tpl', $data);		
					
	}
	public function show2(){

		echo '???????????';
	}	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */